import 'package:flutter_html/flutter_html.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_shop/provide/goods_detail_provide.dart';
import 'package:provide/provide.dart';

class GoodsPane extends StatelessWidget {
  final baseInfo;
  const GoodsPane({ Key key, this.baseInfo }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Provide<GoodsDetailProvider>(builder: (context, child, goodsDetailProvider) {
      final bool isLeft = goodsDetailProvider.isLeft;
      final bool isRight = goodsDetailProvider.isRight;
      print('isLeft $isLeft');
      print('isRight $isRight');
      if (isLeft) {
        return _leftPane();
      } else {
        return _rightPane();
      }
      // return Text('123456');
    });
  }

  Widget _leftPane () {
    return Padding(
      padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(80.0)),
      child: Html(
        data: baseInfo['detail']
      ),
    );
  }
  Widget _rightPane () {
    return Padding(
      padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(80.0)),
      child: Center(child: Text('没有评论'),),
    );
  }
}